package org.mashibing.controller;

import org.mashibing.dto.ResponseResult;
import org.mashibing.dto.TokenResult;
import org.mashibing.response.TokenResponse;
import org.mashibing.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:
 * @create: 2024/4/1 15:10
 * @description: Token相关
 */
@RestController
public class TokenController {

    @Autowired
    private TokenService tokenService;

    /**
     * 刷新token
     */
    @PostMapping("/token-refresh")
    public ResponseResult<TokenResponse> refreshToken(@RequestBody TokenResponse tokenResponse) {
        return tokenService.refreshToken(tokenResponse.getRefreshToken());
    }

}
